\hypertarget{a00048}{}\section{E\+:/knet-\/git/knet/knet/broadcast\+\_\+api.h 文件参考}
\label{a00048}\index{E\+:/knet-\/git/knet/knet/broadcast\+\_\+api.\+h@{E\+:/knet-\/git/knet/knet/broadcast\+\_\+api.\+h}}
{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\\*
\subsection*{函数}
\begin{DoxyCompactItemize}
\item 
\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$ \hyperlink{a00112_ga41a1258d2f4ae75120f26ab7f2326111_ga41a1258d2f4ae75120f26ab7f2326111}{knet\+\_\+broadcast\+\_\+create} ()
\begin{DoxyCompactList}\small\item\em 创建广播域 \end{DoxyCompactList}\item 
void \hyperlink{a00112_ga4b13b2545278c2324f4171ef0bbf990a_ga4b13b2545278c2324f4171ef0bbf990a}{knet\+\_\+broadcast\+\_\+destroy} (\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$broadcast)
\begin{DoxyCompactList}\small\item\em 销毁广播域 \end{DoxyCompactList}\item 
\hyperlink{a00056_a3b7e82599367eade261456f60ebe2cd9_a3b7e82599367eade261456f60ebe2cd9}{kchannel\+\_\+ref\+\_\+t} $\ast$ \hyperlink{a00112_ga1355d3863db663680b1c74363d3a5745_ga1355d3863db663680b1c74363d3a5745}{knet\+\_\+broadcast\+\_\+join} (\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$broadcast, \hyperlink{a00056_a3b7e82599367eade261456f60ebe2cd9_a3b7e82599367eade261456f60ebe2cd9}{kchannel\+\_\+ref\+\_\+t} $\ast$channel\+\_\+ref)
\begin{DoxyCompactList}\small\item\em 加入广播域 \end{DoxyCompactList}\item 
int \hyperlink{a00112_ga3bb02208a76f18bb2eee61955b3781cd_ga3bb02208a76f18bb2eee61955b3781cd}{knet\+\_\+broadcast\+\_\+leave} (\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$broadcast, \hyperlink{a00056_a3b7e82599367eade261456f60ebe2cd9_a3b7e82599367eade261456f60ebe2cd9}{kchannel\+\_\+ref\+\_\+t} $\ast$channel\+\_\+ref)
\begin{DoxyCompactList}\small\item\em 离开广播域 \end{DoxyCompactList}\item 
int \hyperlink{a00112_gabf0b20b2490b3508e58a77314812f1a5_gabf0b20b2490b3508e58a77314812f1a5}{knet\+\_\+broadcast\+\_\+get\+\_\+count} (\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$broadcast)
\begin{DoxyCompactList}\small\item\em 取得广播域内管道数量 \end{DoxyCompactList}\item 
int \hyperlink{a00112_gafd3ac5d785687d729047a51724104060_gafd3ac5d785687d729047a51724104060}{knet\+\_\+broadcast\+\_\+write} (\hyperlink{a00056_a1b551151864af85fa6cce57058153d04_a1b551151864af85fa6cce57058153d04}{kbroadcast\+\_\+t} $\ast$broadcast, char $\ast$buffer, uint32\+\_\+t size)
\begin{DoxyCompactList}\small\item\em 广播 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{函数说明}
\hypertarget{a00112_ga41a1258d2f4ae75120f26ab7f2326111_ga41a1258d2f4ae75120f26ab7f2326111}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+create@{knet\+\_\+broadcast\+\_\+create}}
\index{knet\+\_\+broadcast\+\_\+create@{knet\+\_\+broadcast\+\_\+create}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf kbroadcast\+\_\+t}$\ast$ knet\+\_\+broadcast\+\_\+create (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}\label{a00112_ga41a1258d2f4ae75120f26ab7f2326111_ga41a1258d2f4ae75120f26ab7f2326111}


创建广播域 

\begin{DoxyReturn}{返回}
kbroadcast\+\_\+t实例 
\end{DoxyReturn}
\hypertarget{a00112_ga4b13b2545278c2324f4171ef0bbf990a_ga4b13b2545278c2324f4171ef0bbf990a}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+destroy@{knet\+\_\+broadcast\+\_\+destroy}}
\index{knet\+\_\+broadcast\+\_\+destroy@{knet\+\_\+broadcast\+\_\+destroy}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+destroy}]{\setlength{\rightskip}{0pt plus 5cm}void knet\+\_\+broadcast\+\_\+destroy (
\begin{DoxyParamCaption}
\item[{{\bf kbroadcast\+\_\+t} $\ast$}]{broadcast}
\end{DoxyParamCaption}
)}\label{a00112_ga4b13b2545278c2324f4171ef0bbf990a_ga4b13b2545278c2324f4171ef0bbf990a}


销毁广播域 

销毁的同时会将所有还在域内的管道引用销毁 
\begin{DoxyParams}{参数}
{\em broadcast} & kbroadcast\+\_\+t实例 \\
\hline
\end{DoxyParams}
\hypertarget{a00112_gabf0b20b2490b3508e58a77314812f1a5_gabf0b20b2490b3508e58a77314812f1a5}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+get\+\_\+count@{knet\+\_\+broadcast\+\_\+get\+\_\+count}}
\index{knet\+\_\+broadcast\+\_\+get\+\_\+count@{knet\+\_\+broadcast\+\_\+get\+\_\+count}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+get\+\_\+count}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+broadcast\+\_\+get\+\_\+count (
\begin{DoxyParamCaption}
\item[{{\bf kbroadcast\+\_\+t} $\ast$}]{broadcast}
\end{DoxyParamCaption}
)}\label{a00112_gabf0b20b2490b3508e58a77314812f1a5_gabf0b20b2490b3508e58a77314812f1a5}


取得广播域内管道数量 


\begin{DoxyParams}{参数}
{\em broadcast} & kbroadcast\+\_\+t实例 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
管道数量 
\end{DoxyReturn}
\hypertarget{a00112_ga1355d3863db663680b1c74363d3a5745_ga1355d3863db663680b1c74363d3a5745}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+join@{knet\+\_\+broadcast\+\_\+join}}
\index{knet\+\_\+broadcast\+\_\+join@{knet\+\_\+broadcast\+\_\+join}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+join}]{\setlength{\rightskip}{0pt plus 5cm}{\bf kchannel\+\_\+ref\+\_\+t}$\ast$ knet\+\_\+broadcast\+\_\+join (
\begin{DoxyParamCaption}
\item[{{\bf kbroadcast\+\_\+t} $\ast$}]{broadcast, }
\item[{{\bf kchannel\+\_\+ref\+\_\+t} $\ast$}]{channel\+\_\+ref}
\end{DoxyParamCaption}
)}\label{a00112_ga1355d3863db663680b1c74363d3a5745_ga1355d3863db663680b1c74363d3a5745}


加入广播域 

加入成功会生成一个新的引用 
\begin{DoxyParams}{参数}
{\em broadcast} & kbroadcast\+\_\+t实例 \\
\hline
{\em channel\+\_\+ref} & kchannel\+\_\+ref\+\_\+t \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
kchannel\+\_\+ref\+\_\+t实例，新的在广播域内的引用 
\end{DoxyReturn}
\hypertarget{a00112_ga3bb02208a76f18bb2eee61955b3781cd_ga3bb02208a76f18bb2eee61955b3781cd}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+leave@{knet\+\_\+broadcast\+\_\+leave}}
\index{knet\+\_\+broadcast\+\_\+leave@{knet\+\_\+broadcast\+\_\+leave}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+leave}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+broadcast\+\_\+leave (
\begin{DoxyParamCaption}
\item[{{\bf kbroadcast\+\_\+t} $\ast$}]{broadcast, }
\item[{{\bf kchannel\+\_\+ref\+\_\+t} $\ast$}]{channel\+\_\+ref}
\end{DoxyParamCaption}
)}\label{a00112_ga3bb02208a76f18bb2eee61955b3781cd_ga3bb02208a76f18bb2eee61955b3781cd}


离开广播域 

函数返回后管道引用已经被销毁，不要尝试再次访问这个引用 
\begin{DoxyParams}{参数}
{\em broadcast} & kbroadcast\+\_\+t实例 \\
\hline
{\em channel\+\_\+ref} & kchannel\+\_\+ref\+\_\+t实例，由knet\+\_\+broadcast\+\_\+join()返回 \\
\hline
\end{DoxyParams}

\begin{DoxyRetVals}{返回值}
{\em error\+\_\+ok} & 成功 \\
\hline
{\em 其他} & 失败 \\
\hline
\end{DoxyRetVals}
\hypertarget{a00112_gafd3ac5d785687d729047a51724104060_gafd3ac5d785687d729047a51724104060}{}\index{broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}!knet\+\_\+broadcast\+\_\+write@{knet\+\_\+broadcast\+\_\+write}}
\index{knet\+\_\+broadcast\+\_\+write@{knet\+\_\+broadcast\+\_\+write}!broadcast\+\_\+api.\+h@{broadcast\+\_\+api.\+h}}
\subsubsection[{knet\+\_\+broadcast\+\_\+write}]{\setlength{\rightskip}{0pt plus 5cm}int knet\+\_\+broadcast\+\_\+write (
\begin{DoxyParamCaption}
\item[{{\bf kbroadcast\+\_\+t} $\ast$}]{broadcast, }
\item[{char $\ast$}]{buffer, }
\item[{uint32\+\_\+t}]{size}
\end{DoxyParamCaption}
)}\label{a00112_gafd3ac5d785687d729047a51724104060_gafd3ac5d785687d729047a51724104060}


广播 


\begin{DoxyParams}{参数}
{\em broadcast} & kbroadcast\+\_\+t实例 \\
\hline
{\em buffer} & 缓冲区指针 \\
\hline
{\em size} & 缓冲区长度 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
发送成功管道的数量 
\end{DoxyReturn}
